<!--XOA LOAI CO-->
<?php
if (isset($_GET['remove']))
{
    $kieucoid = $_GET ['kieucoid'];
    $result = mysql_query("DELETE FROM kieuco where kieucoid = $kieucoid; ");
    if ($result)
        print '<h2>Xóa thành công !</h2>';
}
?>

<!--FORM THEM LOAI CO-->
<form action="index.php?quanlybanhang&module=kieuco" method="post"
	enctype="multipart/form-data">
<fieldset><legend>
<h1>Thêm mới loại cổ</h1>
</legend>
<table width="408" border="0">
	<tr>
		<td width="74">Loại cổ</td>
		<td width="318"><label> <input type="text" name="loaico"
			id="textfield" /> </label></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><input type="submit" name="submit" value="Thêm" /></td>
	</tr>
</table>
</fieldset>
</form>

<!--PHP THEM LOAI CO-->
<?php

/*if (isset($_POST['submit']))
{
    //print_r ($_POST);
    $loaico    =   $_POST['loaico'];
    $mysql = "insert into kieuco (loaico) values ('$loaico')";
    $result = mysql_query($mysql);
    if ($result)
        print '<h2>Thành công !</h2>';
}
*/
if (isset($_POST['submit']))
{
    //print_r ($_POST);
    $loaico    =   $_POST['loaico'];
    $mysql = "insert into tinhthanh (tentinhthanh) values ('$loaico')";
    $result = mysql_query($mysql);
    if ($result)
        print '<h2>Thành công !</h2>';
}


?>

<!--HIEN THI CAC LOAI CO-->
<fieldset><legend>
<h1>Các loại cổ :</h1>
</legend>
<table width="695" border="0">
	<tr>
		<td width="100"><b>ID</b></td>
		<td width="300"><b>Loại cổ</b></td>
		<td width="200"><b>Xóa</b></td>
	</tr>

    <?php
        $kieuco = mysql_query("select * from `tinhthanh`");
        while ($row = mysql_fetch_array( $kieuco ) ) {
					
    print "<tr>
		<td width='100'>$row[tinhthanhid]</td>
		<td width='200'>$row[tentinhthanh]</td>
		<td width='200'><a href='index.php?quanlybanhang&module=kieuco&kieucoid=$row[tinhthanhid]&remove' onclick='return confirm('Muốn xóa thật ko?')'>Xóa</a></td>
	</tr>";
    
				}
				?>
</table>
</fieldset>
